package com.yt.sys.service;

import com.yt.sys.models.vo.SysPermissionsVO;
import com.yt.sys.models.vo.SysRoleVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.sys.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.sys.mapper.SysPermissionsMapper;
import com.yt.sys.models.service.ISysPermissionsService;
import com.yt.sys.models.bo.SysPermissionsSaveBO;
import com.yt.sys.models.dto.SysPermissionsDTO;

import java.util.List;

/**
 * 权限详情控制器
 *
 * @author thekai
 * @Date 2025-10-23 11:31:56
 */
@DubboService
public class SysPermissionsServiceImpl extends ServiceImpl<SysPermissionsMapper, SysPermissionsDTO> implements ISysPermissionsService{

    @Resource
    private YmlConfig ymlConfig;
    @Resource
    private SysPermissionsMapper sysPermissionsMapper;

    @Override
    public boolean add(SysPermissionsSaveBO saveBO) {
        SysPermissionsDTO dto = new SysPermissionsDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
    @Override
    public List<SysPermissionsVO> query(){
        List<SysPermissionsVO> sysPermissionsVOS = sysPermissionsMapper.query();
        return sysPermissionsVOS;
    }
}
